﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Role : MonoBehaviour
{
	protected RoleType roleType;
	public RoleType RoleType => roleType;

	protected Animator ani;
	protected Collider2D coli;
	protected Rigidbody2D rig;

	protected int hp;
	public virtual int Hp => hp;        // 总血量

	public int CurrentHp { get; set; }  // 当前血量

	protected int mp;
	public virtual int Mp => mp;        // 总蓝量
	public int CurrentMp { get; set; }  // 当前蓝量

	protected int attack;
	public int Attack => attack;        // 攻击力


	protected virtual void Start() {
		ani = GetComponent<Animator>();
		coli = GetComponent<Collider2D>();
		if (GetComponent<Rigidbody2D>() != null) rig = GetComponent<Rigidbody2D>();
	}



	/// <summary>
	/// 暂停动画
	/// </summary>
	public virtual void OnPauseAni() {
		ani.enabled = false;
		if (coli != null) coli.enabled = false;
	}

	/// <summary>
	/// 继续动画
	/// </summary>
	public virtual void OnContinueAni() {
		ani.enabled = true;
		if (coli != null) coli.enabled = true;
	}
}

public enum RoleType
{
	Player,
	Enemy,
	Bullet,
	Block,
}